import { Column, Entity, Index, PrimaryGeneratedColumn } from "typeorm";

@Index("card_no", ["cardNo"], { unique: true })
@Entity("iot_sim", { schema: "cabinet" })
export class IotSim {
  @PrimaryGeneratedColumn({ type: "int", name: "id", unsigned: true })
  id: number;

  @Column("varchar", {
    name: "card_no",
    unique: true,
    comment: "卡号",
    length: 20,
  })
  cardNo: string;

  @Column("int", {
    name: "expire_in",
    comment: "过期时间",
    unsigned: true,
    default: () => "'0'",
  })
  expireIn: number;

  @Column("decimal", {
    name: "fee",
    comment: "费用",
    precision: 5,
    scale: 2,
    default: () => "'0.00'",
  })
  fee: string;

  @Column("int", {
    name: "device_id",
    comment: "使用的设备",
    unsigned: true,
    default: () => "'0'",
  })
  deviceId: number;

  @Column("int", {
    name: "update_time",
    comment: "更新",
    unsigned: true,
    default: () => "'0'",
  })
  updateTime: number;

  @Column("int", {
    name: "create_time",
    comment: "创建时间",
    unsigned: true,
    default: () => "'0'",
  })
  createTime: number;
}
